package com.welink.cmp.dao.common;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 操作日志 Dao Service
 * 提供操作日志的CRUD操作
 *
 * @author yanwei li
 * @create 2024-05-20 21:23
 */
@Component
public class OperationLogService extends ServiceImpl<OperationLogMapper, OperationLogDO> {

    /**
     * 保存操作日志
     *
     * @param
     * @return 是否保存成功
     */
    public void saveOperationLog(String resourceType, Long resourceId, String operationType, String operator,String remark) {
        OperationLogDO log = new OperationLogDO();
        log.setResourceType(resourceType);
        log.setOperationTime(new Date());
        log.setRemark(remark);
        log.setOperationType(operationType);
        log.setOperator(operator);
        log.setResourceId(resourceId);
        this.save(log);
    }
}